<?php
    foreach($categories as $row){
        $categories_aux[] = $row;
    }
?>
<h1>Product "<?php echo $product->getName(); ?>"</h1>
<a href="<?php echo url_for("@"); ?>">Datos Generales [Edit paso 1]</a>
<br /><br />
<input type="hidden" name="hdProductId" value="<?php echo $product->getId(); ?>" />
<table width="100%" class="table_list" border="1" cellspacing="0" cellpadding="5">
    <thead>
        <tr>
            <td colspan="2" align="center">Datos Generales</td>
        </tr>
    </thead>
    <tbody>
        <tr>
            <td>Nombre</td>
            <td><?php echo $product->getName(); ?></td>
        </tr>
        <tr>
            <td>Url</td>
            <td>http://www.misitio.com/product/<?php echo $product->getUrl(); ?></td>
        </tr>
        <tr>
            <td>Descripción</td>
            <td>
                <?php echo $product->getDescription(); ?>
            </td>
        </tr>
        <tr>
            <td>Categoría</td>
            <td>
                <ul>
                    <?php foreach($categories_aux as $category1){ ?>
                        <?php if($category1->getParentId()==null){ ?>
                            <li>
                                <?php if($product->getCategoryId()==$category1->getId()){ ?>
                                    <input type="radio" checked="checked" disabled="disabled" />
                                <?php } ?>
                                <?php echo $category1->getName(); ?>
                            </li>
                            <ul>
                                <?php foreach($categories_aux as $category2){ ?>
                                    <?php if($category2->getParentId()==$category1->getId()){ ?>
                                        <li>
                                            <?php if($product->getCategoryId()==$category2->getId()){ ?>
                                                <input type="radio" checked="checked" disabled="disabled" />
                                            <?php } ?>
                                            <?php echo $category2->getName(); ?>
                                        </li>
                                        <ul>
                                            <?php foreach($categories_aux as $category3){ ?>
                                                <?php if($category2->getId()==$category3->getParentId()){ ?>
                                                <li>
                                                    <?php if($product->getCategoryId()==$category3->getId()){ ?>
                                                        <input type="radio" checked="checked" disabled="disabled" />
                                                    <?php } ?>
                                                    <?php echo $category3->getName(); ?>
                                                </li>
                                                <?php } ?>
                                            <?php } ?>
                                        </ul>
                                    <?php } ?>
                                <?php } ?>
                            </ul>
                        <?php } ?>
                    <?php } ?>
                </ul>
            </td>
        </tr>
        <tr>
            <td>Precio Estándar</td>
            <td>S/.<?php echo $product->getPrice(); ?></td>
        </tr>
    </tbody>
</table>
<br /><hr /><br />
<a href="<?php echo url_for("@"); ?>">Atributos [Edit paso 2]</a>
<br /><br />
<input type="hidden" name="hdProductId" value="<?php echo $product->getId(); ?>" />
<table width="100%" class="table_list" border="1" cellspacing="0" cellpadding="5">
    <thead>
        <tr>
            <td colspan="3" align="center">Atributos</td>
        </tr>
        <tr>
            <td>Atributo Personalizado</td>
            <td>Tipo de normalización</td>
            <td>Valor de normalización</td>
        </tr>
    </thead>
    <tbody>
        <?php foreach($product_attributes as $product_attribute){ ?>
        <tr>
            <td><?php echo $product_attribute->getCustomAttribute()->getName(); ?></td>
            <td><?php echo $product_attribute->getCustomAttribute()->getTypeRelatedByNormalizationTypeId()->getName(); ?></td>
            <td>
                <?php
                    if($product_attribute->getCustomAttribute()->getTypeRelatedByNormalizationTypeId()->getGroup()==1 &&
                       $product_attribute->getCustomAttribute()->getTypeRelatedByNormalizationTypeId()->getValue()==1){
                        echo $product_attribute->getCustomAttributeOption()->getValue();
                    }else{
                        echo $product_attribute->getTextValue();
                    }
                ?>
            </td>
        </tr>
        <?php } ?>
    </tbody>
</table>
<br /><hr /><br />
<a href="<?php echo url_for("@"); ?>">Datos Generales [Edit paso 3]</a>